<template>
<div>
   {{ list }}
    <el-menu
      default-active="2"
      class="el-menu-vertical-demo"
      @open="handleOpen"
      @close="handleClose"
      background-color="rgb(52, 55, 68)"
      text-color="#fff"
      active-text-color="#ffd04b" router="true">
      <el-submenu :index="index+1" v-for="(i,index) in menulist" :key="index" >
        <template slot="title">
          <i class="el-icon-location"></i>
          <span>{{i.name}}</span>
        </template>
        <el-menu-item-group>
          <el-menu-item :index='s.url' v-for="(s,ind) in i['son']" :key="ind">
            {{s.name}}
          </el-menu-item>
        </el-menu-item-group>
        </el-submenu>
        
      
    </el-menu>
</div>


</template>

<script>
export default {
    data() {
      return {
       menulist:[],
       roleid:localStorage.getItem('roleid')
       
      };
    },
    methods: {
      handleOpen(key, keyPath) {
        console.log(key, keyPath);
      },
      handleClose(key, keyPath) {
        console.log(key, keyPath);
      },
      getmenu(){
        this.axios.get('leftmenu?roleid='+this.roleid)
        .then(res=>{
          this.menulist = res.data.list
        })
      }
    },
    mounted(){
      this.getmenu()
    }

}
</script>

<style>
.logo {
  text-align: center;
  background-color: rgb(52, 55, 68);
  /* height: 100px;
  line-height: 100px;
  padding: 12px 5px; */
  padding: 46px 37px 67px 36px;
  border-right: solid 1px #e6e6e6;
  height: 15px;
}
</style>